const mongoose = require('mongoose')
const db = require('./db')
// Schema 结构
var studentSchema = new mongoose.Schema({
  name: {type : String},
  age: {type : Number},
  sex: {type : String}
})

// 创建静态方法
studentSchema.statics.zhaoren = function(name, callback) {
  this.model('Student').find({name: name}, callback)
}

// 创建修改人静态方法
studentSchema.statics.xiugai = function(conditions, update, options, callback) {
  this.model('Student').update(conditions, update, options, callback)
}



// 创建了一个学生模型, 并导出
module.exports = studentSchema = db.model('Student', studentSchema)

